# -*- coding:utf-8 -*-
# @FileName  :per_archive_revise.py
# @Time      :2020/12/24 15:31
# @Author    :Zhoujirong
# @Desc      :信息补录页面
import os
from common.http_request import Request
from biz.support.urls import ServerUrl
from conf.settings import PICTURES_DATA_PATH
class PerArchiveReviseRequest:
    @classmethod
    def archive_create(cls, archiveType, Num, clientName, cretType, cretNo, startDate, expireDate, note, paperfileid,
                       filedescribe,isRevise, cookie):
        data = {
            'archiveType': archiveType,
            'Num': Num,
            'clientName': clientName,
            'cretType': cretType,
            'cretNo': cretNo,
            'startDate': startDate,
            'expireDate': expireDate,
            'note': note,
            'paperfileid': paperfileid,
            'filedescribe': filedescribe,
            'isRevise': isRevise
        }
        req = Request(ServerUrl.archive_create_url, data=data, headers=cookie)
        return req.post()

    @classmethod
    def get_page(cls,curPage,
            maxSize,
            search_EQ_customerName,
            search_EQ_certType,
            search_EQ_certNo,
            search_EQ_qryReason,
            search_EQ_queryType,
            search_EQ_queryFormat,
            search_EQ_source,
            search_EQ_status,
            search_GTE_LTE_queryTime_DATE_RANGE,
            search_EQ_operator,
            search_IN_operOrg,cookie):

        params = {
            'curPage':curPage,
            'maxSize':maxSize,
            'search_EQ_customerName':search_EQ_customerName,
            'search_EQ_certType':search_EQ_certType,
            'search_EQ_certNo':search_EQ_certNo,
            'search_EQ_qryReason':search_EQ_qryReason,
            'search_EQ_queryType':search_EQ_queryType,
            'search_EQ_queryFormat':search_EQ_queryFormat,
            'search_EQ_source':search_EQ_source,
            'search_EQ_status':search_EQ_status,
            'search_GTE_LTE_queryTime_DATE_RANGE':search_GTE_LTE_queryTime_DATE_RANGE,
            'search_EQ_operator':search_EQ_operator,
            'search_IN_operOrg':search_IN_operOrg
        }
        req = Request(ServerUrl.per_archiverevise_getpage_url,params=params,headers=cookie)
        return req.get()

    @classmethod
    def page(cls,cookie):
        req = Request(ServerUrl.per_archiverevise_page_url,headers=cookie)
        return req.get()

    @classmethod
    def type(cls,cookie):
        '''获取授权类型'''
        req = Request(ServerUrl.per_archiverevise_type_url,headers=cookie)
        return req.get()

    @classmethod
    def uploadfile(cls,file,
        fileType,
        archiveId,
        resultInfoId,
        md5,
        needMd5,cookie):
        file = {
            'file': open(os.path.join(PICTURES_DATA_PATH, '%s') % file, 'rb')
        }
        data = {
            'fileType':fileType,
            'archiveId':archiveId,
            'resultInfoId':resultInfoId,
            'md5':md5,
            'needMd5':needMd5
        }
        req = Request(ServerUrl.per_archiverevise_uploadfile_url,data=data,files=file,headers=cookie)
        return req.post()

    @classmethod
    def savepaper(cls,paperFileId,
        fileDescribe,
        archiveid,
        resultInfoId,cookie):
        '''补录授权信息保存'''
        data = {
            'paperfileid':paperFileId,
            'filedescribe':fileDescribe,
            'archiveid':archiveid,
            'resultInfoId':resultInfoId
        }
        req = Request(ServerUrl.per_archiverevise_savepaper_url,data=data,headers=cookie)
        return req.post()

    @classmethod
    def list(cls,cookie):
        req = Request(ServerUrl.per_archiverevise_list_url,headers=cookie)
        return req.get()






if __name__ == "__main__":
    pass